<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        const array = [1, 2, 3, 5, 1, 5, 9, 1, 2, 8];
        // let res = Array.from(new Set(array))
        // console.log(res)

        function UniqueArray(arr){
            let map = {}
            let res = []
            for(let i=0;i<arr.length;i++){
                if(!map.hasOwnProperty(arr[i])){
                    map[arr[i]] = 1;
                    res.push(arr[i])
                }
            }
            return res
        }
        console.log(UniqueArray(array))
    </script>
    
</body>
</html>